Skip to content

ADFA-3462 | Add Get AI Models plugin - #55

Merged
jatezzz merged 1 commit into
mainfrom
feature/ADFA-3462-get-ai-models-plugin
Jul 31, 2026
Merged

ADFA-3462 | Add Get AI Models plugin#55
jatezzz merged 1 commit into
mainfrom
feature/ADFA-3462-get-ai-models-plugin

Conversation

@jatezzz

@jatezzz jatezzz commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a new plugin, Get AI Models, that contributes a tab to the project editor's bottom drawer for downloading small GGUF language-model files.

  • Catalog: a bundled static JSON asset (src/main/assets/catalog/models.json) with 6 curated entries, all under 1 GB. One row = one file (a model at one quantization); tapping a row expands publisher, licence, minimum RAM, context window, and a strengths/weaknesses note. No remote catalog, a revised list ships as a new plugin version.
  • Download: blocked with a message when offline; a metered connection warns with the file size before proceeding. Transfers run through Android's DownloadManager into /sdcard/Download, plugin-scoped so closing the tab doesn't abandon them. Paused states are surfaced rather than hidden (Paused, waiting for Wi-Fi).
  • Checksum gate: the finished file is streamed and hashed against a pinned SHA-256. Match keeps it; mismatch deletes it and offers a re-download. Download resolution walks three tiers (file:// URI → COLUMN_LOCAL_FILENAMEcontent://) because COLUMN_LOCAL_URI is not guaranteed to be a filesystem path on newer platforms; a naive File(uri.path) failed otherwise-good downloads.
  • Verified-state record: one small SharedPreferences entry per verified file (entryId → {absolutePath, sizeBytes, verifiedAt}), revalidated with a single stat on activation so a Downloaded badge is never shown without the disk agreeing. Expanded rows offer Verify file again and Delete file (destructive, confirms first, deletes only the recorded path).

Download only, loading or running a model stays with the llama.cpp-based AI plugins. This plugin never loads a model and never reads device RAM.

Also wires the plugin into README.md's Examples table and the MAP array in .github/workflows/update-libs.yml so it ships to the website.

Details

  • Day/night theming via values-night/colors.xml and the plugin inflater, no hardcoded colors.
  • In-IDE help: six DocumentationExtension entries (tab, row, Download / Cancel / Verify / Delete) under category plugin_org.appdevforall.getaimodels, with the tab's tooltip linking the bundled offline guide at src/main/assets/docs/index.html.
  • Unit tests (../gradlew test) cover the catalog loader (re-validating the shipped asset), download-state transitions, the three-tier path resolver, the file gate, and the verified-model store.
  • Uses the shared repo-root Gradle wrapper and libs/ jars, no per-plugin wrapper or jars.
  • Permissions: network.access, filesystem.read, filesystem.write. No native code, no system commands, no IDE settings, no project-structure access.
  • plugin.min_ide_version / max_ide_version: 26.2926.31.
document_5139137749319681813.mp4

Ticket

ADFA-3462

Observation

Two items worth flagging, all documented in get-ai-models/README.md and docs/CURATION.md:

  1. Per-row progress is an approved deviation. The ticket locks progress to the system notification only. The row shows a fill behind the Cancel control, implemented after on-device testing, because the notification is dismissible and once dismissed a slow download is indistinguishable from one paused indefinitely for Wi-Fi.
  2. The verified-state record is a model registry, which the ticket lists as out of scope. implemented after a verified 4 GB download lost its badge on every IDE restart. The neighbouring exclusion, handling pre-existing files, is still honoured: nothing without a record is read, verified, or deleted.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

…ecksum-gated downloads

Bottom-drawer tab listing 11 curated fully-open GGUF files; downloads via DownloadManager to /sdcard/Download and keeps one only if its pinned SHA-256 matches. Verified files are remembered across restarts and revalidated by stat.
@jatezzz
jatezzz force-pushed the feature/ADFA-3462-get-ai-models-plugin branch from f211db9 to c7b46ef Compare July 31, 2026 15:05
@jatezzz
jatezzz merged commit c87f6a2 into main Jul 31, 2026
@jatezzz
jatezzz deleted the feature/ADFA-3462-get-ai-models-plugin branch July 31, 2026 15:31
hal-eisen-adfa added a commit that referenced this pull request Aug 6, 2026
Two plugins landed on main after this branch was cut, so they were never
standardized:

- project-to-template (#56): compileSdk/targetSdk 34 -> 36
- get-ai-models (#55):       Kotlin 2.1.0 -> 2.3.0

Both get-ai-models and template-manager pin Kotlin twice: the
kotlin-gradle-plugin classpath in settings.gradle.kts, and `kotlin` in
gradle/libs.versions.toml, which drives libs.kotlin.stdlib. The catalog
comment states the two must match, so both were bumped.

That surfaced a defect in this branch: it had already bumped
template-manager's classpath to 2.3.0 but left its catalog at 2.1.0, so
the compiler and stdlib disagreed. Fixed here.

Verified: all 27 plugins now report compileSdk/targetSdk 36, AGP 8.11.0,
Kotlin 2.3.0, with no catalog left at an older pin. All four affected
plugins build assemblePlugin successfully; kotlin-stdlib resolves to
2.3.0 in get-ai-models and template-manager, and the packaged manifests
of project-to-template and get-ai-models report targetSdkVersion=36.
hal-eisen-adfa added a commit that referenced this pull request Aug 7, 2026
…P 8.11.0, Kotlin 2.3.0, Gradle 8.14.3 (#54)

* ADFA-4907 | Standardize plugin toolchain: compileSdk/targetSdk 36, AGP 8.11.0, Kotlin 2.3.0, Gradle 8.14.3

Aligns all 25 example plugins with Code On The Go's on-device build toolchain
(verified on device: CoGo ships only android-36, AGP 8.11.0, Gradle 8.14.3;
does not pin Kotlin). Relevant because plugins are being built with CoGo itself
(ADFA-4693).

- compileSdk & targetSdk -> 36 (22 plugins; 3 template installers already 36)
- AGP -> 8.11.0 (ai-assistant, ai-core from 8.13.2; client-time-tracker,
  compose-preview, layout-editor from 8.8.2 -- downgrades intentional, match CoGo)
- Kotlin -> 2.3.0 (flutter-template, pebble, template-manager from 2.1.0)
- Gradle wrapper -> 8.14.3 (ai-assistant, ai-core from 8.14.4; client-time-tracker,
  compose-preview, layout-editor from 8.10.2)
- template-manager: migrate deprecated kotlinOptions.jvmTarget string DSL to
  compilerOptions { jvmTarget.set(JvmTarget.JVM_17) } (required by Kotlin 2.3.0)

Java/jvmTarget already uniform at 17. 20/25 plugins build clean. 5 (ai-assistant,
ai-core, code-suggestions-plugin, speech-to-text-plugin, vector-search-plugin)
fail with pre-existing unresolved-reference errors (stale libs/plugin-api.jar,
missing newer API symbols) -- verified failing at baseline before this change,
out of scope here.

* ADFA-4907 | Extend toolchain standardization to 3 missed plugins

Two plugins landed on main after this branch was cut, so they were never
standardized:

- project-to-template (#56): compileSdk/targetSdk 34 -> 36
- get-ai-models (#55):       Kotlin 2.1.0 -> 2.3.0

Both get-ai-models and template-manager pin Kotlin twice: the
kotlin-gradle-plugin classpath in settings.gradle.kts, and `kotlin` in
gradle/libs.versions.toml, which drives libs.kotlin.stdlib. The catalog
comment states the two must match, so both were bumped.

That surfaced a defect in this branch: it had already bumped
template-manager's classpath to 2.3.0 but left its catalog at 2.1.0, so
the compiler and stdlib disagreed. Fixed here.

Verified: all 27 plugins now report compileSdk/targetSdk 36, AGP 8.11.0,
Kotlin 2.3.0, with no catalog left at an older pin. All four affected
plugins build assemblePlugin successfully; kotlin-stdlib resolves to
2.3.0 in get-ai-models and template-manager, and the packaged manifests
of project-to-template and get-ai-models report targetSdkVersion=36.

* ADFA-4907 | Enforce the standard toolchain in CI

Adds scripts/check-toolchain.sh and a pull_request-triggered workflow that
fails the build when any Gradle module drifts off the ADFA-4907 standard
(compileSdk/targetSdk 36, AGP 8.11.0, Kotlin 2.3.0, Gradle 8.14.3-bin,
Java 17).

Until now nothing enforced this. Both existing workflows are
workflow_dispatch-only, so a PR could move any of these values with zero CI
signal — which is how origin/main still carries compileSdk 33/34/35, AGP
8.8.2/8.13.2 and Gradle 8.10.2. The check is pure text inspection (no JDK,
no Gradle, no network), so it runs in seconds and is cheap to require.

It walks every build.gradle.kts, including subprojects. The earlier sweep
enumerated only top-level plugin folders, which is why ai-core/llama-impl
kept compileSdk = 34 through a dedicated standardization pass.

Files under src/main/assets/ are excluded: those are project templates that
Code On The Go stamps out for the user's own app, not our builds.

minSdk is deliberately not checked — it legitimately varies (21 template
installers, 26 most, 28 Beepy/sketch-to-ui, 33 the AI plugins).

Also fixes the nine violations the check found, so it lands green:
  * kotlin-stdlib pinned behind the Kotlin plugin -> 2.3.0
    (flutter-template, bookshelf, ndk-installer-plugin, cotg-ndk, pebble)
  * ai-core/llama-impl compileSdk 34 -> 36
  * ai-assistant + ai-core wrapper -all.zip -> -bin.zip
  * ai-core catalog agp "8.13.2" -> "8.11.0" (contradicted settings.gradle.kts)

* ADFA-4907 | Simplify check-toolchain.sh

Collapses the nine copy-pasted "extract, compare, report" blocks into two
helpers (check_value for first-match keys, check_every for all-match keys),
plus small file_matches/reject/module_of helpers.

That duplication had already caused a real defect: four of the nine copies
omitted the --list echo, so --list silently under-reported the
compose-compiler pin, the wrapper bin/all flavor, and both catalog entries.
Recording the value is now part of the helper, so it cannot be forgotten.
--list goes from 5 fact types / 134 lines to 9 / 164, sorted by module
instead of grouped by internal scan order.

Also:
  * One matching idiom. The header claimed grep|sed was avoided for BSD sed
    portability, then the kotlin-stdlib check used exactly that. Everything
    is bash =~ now, so the claim is true and no subprocesses are spawned.
  * One find traversal with a case dispatch instead of four full walks of
    the 12.8k-entry tree. Runtime 1.02s -> 0.38s.
  * Documents why discovery is deliberately broader than plugin_dirs() in
    .githooks/pre-push, so a future "DRY win" does not silently drop
    ai-core/llama-api and llama-impl from coverage.
  * Narrows the --list usage text, which overstated what it prints.
  * Workflow header no longer restates the version numbers (third copy).

Deliberately NOT changed: no declarative rules table (four of the checks
have genuinely different shapes and a table would gut the failure-message
hints), and the standard stays a set of literal constants rather than being
derived from the root wrapper -- deriving it would make a wrong root wrapper
undetectable.

* ADFA-4907 | Align dependency versions across the AI plugins

The toolchain check enforces compileSdk/AGP/Kotlin/Gradle/Java, but every
other library version is unchecked, and the AI plugins had drifted as a
group -- all four kotlinx-coroutines 1.7.3 pins in the repo were AI plugins,
against a repo majority of 1.8.1.

Library alignments (all upgrades to the repo majority):
  * kotlinx-coroutines 1.7.3 -> 1.8.1 in ai-core, code-suggestions-plugin,
    speech-to-text-plugin, vector-search-plugin; -test 1.7.3 -> 1.8.1 in
    ai-assistant; get-ai-models catalog 1.6.4 -> 1.8.1 (was the oldest pin
    in the repo)
  * androidx.lifecycle 2.6.2 -> 2.8.7 in code-suggestions-plugin,
    speech-to-text-plugin and the get-ai-models catalog, matching
    client-time-tracker / compose-preview / sketch-to-ui
  * ai-assistant fragment-ktx 1.6.2 -> 1.8.8. This was the only 1.6.2 in the
    repo against 17 modules on 1.8.8, and the comment directly above it
    claimed the block matched random-xkcd, sketch-to-ui-plugin and Beepy --
    all three of which are on 1.8.8. The comment is now true.
  * ai-assistant org.json 20231013 -> 20240303

Deliberately NOT changed: coordinates where the AI plugins are merely AHEAD
of the majority (get-ai-models material 1.12.0, ai-literacy webkit 1.11.0,
llama-impl slf4j 2.0.12). Being ahead is not a defect, and downgrading
carries real risk for no gain.

ai-core/gradle/libs.versions.toml: pruned 334 lines -> 40.

It was copied wholesale from the CodeOnTheGo app repo and declared 281
entries of which exactly 4 were ever referenced (98.6% dead). The dead bulk
had drifted into self-contradiction -- androidx.core:core-ktx declared at
three different versions, appcompat at two, gson at two, plus a malformed
ksp = "2.3.6" and typo'd keys ("anroidx"). That is not inert: it is the
number the next person greps for.

While pruning, the two surviving aliases that encoded their version in the
NAME (androidx-core-ktx-v1120, androidx-appcompat-v171) were renamed to
version-neutral names, since such a name lies the moment the version moves.
Call sites in llama-impl updated to match.

The catalog also resolved two real conflicts inside a single Gradle build:
appcompat was 1.7.1 there while ai-core/build.gradle.kts pinned 1.6.1, and
llama-api pulled coroutines-core 1.10.2 while ai-core pulled
coroutines-android 1.8.1 -- the coroutines artifacts are released as a set
and must not be split.

Verified: all six changed AI plugins build assemblePluginDebug clean and
emit a .cgp. Resolved classpaths confirm coroutines is now uniformly 1.8.1
in ai-core (previously split), lifecycle 2.8.7, fragment-ktx 1.8.8. The
renamed catalog aliases were verified by forcing llama-api/llama-impl into
the build, with a negative control proving an unknown alias fails loudly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants